package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.dto.CategoryDto;
import com.spzx.product.api.factory.RemoteCategoryFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

/**
 * 商品分类
 *
 * @author gaozz
 */
@FeignClient(contextId = "remoteCategoryService",
        value = ServiceNameConstants.PRODUCT_SERVICE,
        fallbackFactory = RemoteCategoryFallbackFactory.class)
public interface RemoteCategoryService {

    /**
     * 获取商品一级分类集合
     *
     * @param source
     * @return
     */
    @GetMapping("/category/getCategoryLevel1")
    R<List<CategoryDto>> getCategoryLevel1(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取商品分类整体树形结构
     *
     * @return
     */
    @GetMapping("/category/allTree")
    R<List<CategoryDto>> allTree(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
